Repository navigation
fix(pkarr-worker): fail closed on unrecognized deploy arguments (#3264) - #4946
Conversation
deploy.mjs read only the exact spellings --dry-run and --deploy-version <id> and ignored everything else, so a typo'd --dry-rnu or the --deploy-version=<id> form fell through to a real deploy of HEAD. Parsing now lives in deploy-args.mjs and rejects any unknown argument, a missing or empty version id, and --dry-run with a value, before any bws/cf call. The equals form is accepted and matches the space form. --dry-run with --deploy-version stays accepted so #3252 can make it preview a rollback.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 53 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
🤖 Agent note · merge-ready (task 6815 resume)
|
What
pkgs/pkarr-worker/deploy.mjsnow fails closed on arguments it does not understand, before anybws/cfcall.Today the script read exactly
--dry-runand--deploy-version <id>and silently dropped everything else, so--dry-rnu,--prodor--deploy-version=<id>fell through to a real deploy of HEAD.Change
pkgs/pkarr-worker/deploy-args.mjswithparseArgs(argv)andUSAGE— pure, no node APIs, so it is testable without running a deploy.deploy.mjscalls it first and exits2with the offending argument and the usage on any error.--dry-run,--deploy-version <id>,--deploy-version=<id>(new), and--dry-runcombined with--deploy-version(kept, so pkarr-worker(deploy): --dry-run is ignored on the --deploy-version path — a rollback preview creates a real 100% deployment #3252 can make that preview a rollback).--dry-run=<value>, a missing/empty version id, and--deploy-versionfollowed by another flag.deploy-args.d.mtsgives the TS test andtsc --noEmitreal types without addingallowJsto the package.Verification
npx vitest run test/deploy-args.test.ts— 13/13 pass (accept forms, rejections, usage in every message).npx tsc --noEmit— clean.bws/cfonPATH,CLOUDFLARE_ACCOUNT_IDstubbed:node deploy.mjs --dry-rnu→ exit 2,unrecognized argument "--dry-rnu"+ usage, zerocf/bwscalls.--prod,--deploy-version=and a bare--deploy-version.node deploy.mjs --deploy-version v-rollback-123→ still creates the deployment at that version (workers deployments create … "version_id":"v-rollback-123"), so the known-good rollback path is unchanged.Local test run needed
npm install --legacy-peer-depsbecause of a pre-existing lockfile drift on main (package.jsonasksvitest@^4,package-lock.jsonpins 3.2.7 andnpm cirefuses; with 4.x the Cloudflare workers pool refuses to run). Run withvitest@3.2.7, matching the lock, to exercise the pool. No lockfile orpackage.jsonchange is part of this PR.Closes #3264. Sibling of #3252 (dry-run on the
--deploy-versionpath), which this deliberately leaves room for.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.